#ifndef GRABBER_H
#define GRABBER_H

#include <pcap.h>
#include "dispatcher.h"

using namespace std;

class Grabber {
public:
	Grabber();
	~Grabber();
	
	void init(const char *dev, const char *filter);
	void startLoop();
	void stopLoop();
	
	void setDispatcher(Dispatcher *);

private:
	static void callback(uint8_t *, const pcap_pkthdr *, const uint8_t *);

	Dispatcher *_dispatcher;
	pcap_t *_descr;
	bpf_program _filterProg;
	bpf_u_int32 _mask;
	bpf_u_int32 _net;
};

#endif

